require 'fileutils'

namespace "build" do
    task :all do
        rhorootdir = ENV['RHO_ROOT']
        raise "RHO_ROOT is not set" if rhorootdir.nil?

        $app_path = ENV["RHO_APP_DIR"]
        raise "RHO_APP_DIR is not set" if $app_path.nil?

        require File.join(rhorootdir, 'platform','iphone','rbuild','buildextension')

        IPhoneBuild.load_env_for_build_rhodes_ios_extension

        target_app = File.join($app_path, 'project', 'iphone')

        cp_r File.join($app_path, 'GoogleService-Info.plist'), target_app


        extension_name = "fcm-push"
        extension_lib_name = "fcm-push"
        extension_xcode_target_name = "fcm-push"

        ret= IPhoneBuild.build_rhodes_ios_extension(extension_name, extension_lib_name, extension_xcode_target_name)
    end
end

task :default => "build:all"
